package w83a.w83aOperacionesPaso.w83aActas;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import w83a.w83aBeans.W83aActasBean;
import w83a.w83aUtilidades.W83aUtilidadesComunes;
import w83a.w83aUtilidadesComunes.W83aClsConstantes;

import es.ejie.frmk.presentacion.operacion.paso.Q70ActionPasoOP;
import es.ejie.frmk.presentacion.sesiondatos.Q70ContextoEJIE;

public class W83aCargarListasOPAction extends Q70ActionPasoOP{

	
	protected void processOP(Q70ContextoEJIE contexto, ActionErrors errores, ActionMapping mapping,
			ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		W83aActasBean actaBean=(W83aActasBean)contexto.get("w83aNuevaActaBean");
		
		W83aActasBean acta = new W83aActasBean();
		
		if(StringUtils.isEmpty(actaBean.getNumActaAno())){
			actaBean = (W83aActasBean)contexto.get("w83aDetalleActaTempBean");///leire
			acta = new W83aActasBean(actaBean);
		}else{
			acta = new W83aActasBean(actaBean);			
		}
		
		if(!"documentos".equals(request.getParameter("accion"))){
			acta = (W83aActasBean)W83aUtilidadesComunes.inicializarPaginador(request, acta);
			actaBean = new W83aActasBean(acta);
		}
		actaBean.setIdioma((String)contexto.get(W83aClsConstantes.CONSTANTE_CONTEXTO_IDIOMA));
		contexto.set("w83aNuevaActaBean",actaBean);
	}

	protected ActionForward processForward(Q70ContextoEJIE contexto, ActionErrors errors, ActionMapping mapping, 
			ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

				W83aActasBean acta=(W83aActasBean)contexto.get("w83aNuevaActaBean");
				acta.setPestana(request.getParameter("accion"));
				return mapping.findForward("ok");

	}

}
